class Stack{
    constructor(){
        this.items = [];
    }

    push(){
        if(arguments.length != 1) {
            throw Error("Only accept a argument");
        }
        this.items.push(arguments[0]);
    }

    pop(){
        if(!this.items.length){
            throw Error('Empty stack');
        }
        return this.items.pop();
    }

    isEmpty(){
        return !this.items.length;
    }

    size(){
        return this.items.length;
    }
    toString(){
        return this.items.join(';');
    }
}

module.exports = Stack;